<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class Project extends Model
{
    use HasDateTimeFormatter;
    use SoftDeletes;

    static public $statusToSchedule = [
        0 => 0,
        1 => 20,
        2 => 40,
        3 => 60,
        4 => 80,
        5 => 100,
    ];

    /**
     * 项目负责人
     */
    public function projectusers()
    {
        return $this->belongsTo('App\Models\AdminUser', 'prouser', 'id');
    }

    public function saleusers()
    {
        return $this->belongsTo('App\Models\AdminUser', 'user_id', 'id');
    }

    /**
     * 项目来源
     */
    public function prosource()
    {
        return $this->belongsTo('App\Models\ProSource', 'source', 'id');
    }

    /**
     * 客户
     */
    public function customer()
    {
        return $this->belongsTo('App\Models\Customer', 'customer_id', 'id');
    }

    /**
     * 技术人员
     */
    public function technicalstaffs()
    {
        return $this->hasOne('App\Models\AdminUser', 'id', 'technical_staff');
    }
}
